package br.com.biblioteca.controller;

import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.Filter;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author joaosavio
 */
public class FilterManager implements Filter {

    public void processFilter(HttpServletRequest request, HttpServletResponse response) throws Exception {
        FilterChain filterChain = new FilterChain();
        filterChain.processFilter(request, response);
    }

    public void init(FilterConfig filterConfig) throws ServletException {

    }

    public void doFilter(ServletRequest request, ServletResponse response, javax.servlet.FilterChain chain) {
        HttpServletRequest hreq = (HttpServletRequest) request;
        HttpServletResponse hres = (HttpServletResponse) response;
        FilterChain filterChain = new FilterChain();
        try {
            filterChain.processFilter(hreq, hres);
            chain.doFilter(request, response);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void destroy() {

    }
}
